package DB;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;


public class javaconnect {

    

    public static Connection ConnecrDb() {
        Connection conn = null;
        try {
            Class.forName("com.mysql.jdbc.Driver"); // connection to db progr.
           conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/nlr","root",""); // connection to DB
            return conn;
        } catch (SQLException e) {
            JOptionPane.showMessageDialog(null, e);
            return null;
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(javaconnect.class.getName()).log(Level.SEVERE, null, ex);
            return null;

        }
    }

}
